package com.cloud.school.app.util.enumeration;

import java.util.HashMap;
import java.util.Map;

/**
 * @ClassName IMMessageType
 * @Description Im消息类型说明
 * @Author pc
 * @Date 2018/8/18 10:07
 * @Version 1.0
 */
public enum GroupMemberStatus {
    UNHANDLED(1, "未处理"),
    HANDLED(2, "已处理");

    private int code;
    private String value;

    GroupMemberStatus(int code, String value) {
        this.code = code;
        this.value = value;
    }

    public int getCode() {
        return code;
    }

    public String getValue() {
        return value;
    }

    public static GroupMemberStatus codeOf(int code) {
        for (GroupMemberStatus status : values()) {
            if (status.getCode() == code) {
                return status;
            }
        }
        return null;
    }

    public static String codeToValue(int code) {
        for (GroupMemberStatus status : values()) {
            if (status.code == code) {
                return status.value;
            }
        }
        return "";
    }

    public static Map<String, String> toMap() {
        Map<String, String> detail = new HashMap();
        for (GroupMemberStatus status : values()) {
            detail.put(status.code + "", status.value);
        }
        return detail;
    }
}
